/*
** item.c for item in /home/hubert_s//test/list_C
** 
** Made by sevan hubert
** Login   <hubert_s@epitech.net>
** 
** Started on  Tue Feb  8 13:42:45 2011 sevan hubert
** Last update Tue Jun 28 14:01:20 2011 sevan hubert
*/

#include <stdlib.h>
#include <stdio.h>

#include "item.h"
#include "xfuncs.h"

item	*alloc_list_item()
{
  item	*new;

  new = (item*)xmalloc(sizeof(*new));
  if (new == NULL)
    {
      printf("Error malloc : can not allocate memory.\n");
      exit(0);
    }
  return (new);
}

void	init_list_item(item *to_init, void *object, unsigned int size)
{
  if (to_init)
    {
      to_init->object = object;
      to_init->next = NULL;
      to_init->prev = NULL;
      to_init->size = size;
    }
}

void	copy_list_item(item *to_init, item *srcs)
{
  if (srcs && to_init)
    init_list_item(to_init, srcs->object, srcs->size);
  else if (!srcs && to_init)
    init_list_item(to_init, NULL, 0);
}
